﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.ModFlow.Controls.PresentationClass.DataSetValue
{
    /// <summary>
    /// 此类用于对向量属性的转换
    /// </summary>
    class VectorView
    {
        public VectorView()
        {
        }
        public VectorView(int row,int col,int lay,double x,double y,double z)
        {
            this.RowIndex = row;
            this.ColIndex = col;
            this.LayerIndex = lay;
            this.VxValue = x;
            this.VyValue = y;
            this.VzValue = z;
        }
        private int _layerIndex;
        /// <summary>
        /// 第N层
        /// </summary>
        public int LayerIndex
        {
            get { return _layerIndex; }
            set { _layerIndex = value; }
        }
        private int _rowIndex;
        /// <summary>
        /// 第N行
        /// </summary>
        public int RowIndex
        {
            get { return _rowIndex; }
            set { _rowIndex = value; }
        }
        private int _colIndex;
        /// <summary>
        /// 第N列
        /// </summary>
        public int ColIndex
        {
            get { return _colIndex; }
            set { _colIndex = value; }
        }
        private double _vxValue;
        /// <summary>
        /// 向量X
        /// </summary>
        public double VxValue
        {
            get { return _vxValue; }
            set { _vxValue = value; }
        }
        private double _vyValue;
        /// <summary>
        /// 向量Y
        /// </summary>
        public double VyValue
        {
            get { return _vyValue; }
            set { _vyValue = value; }
        }
        private double _vzValue;
        /// <summary>
        /// 向量Z
        /// </summary>
        public double VzValue
        {
            get { return _vzValue; }
            set { _vzValue = value; }
        }
        /// <summary>
        /// 把数据转换为datagrid显示的格式
        /// </summary>
        /// <returns></returns>
        public List<VectorView> GetVectorViewData(HA.Data. FlowVector[, ,] data)
        {
            List<VectorView> arry = new List<VectorView>();
            for (int i = 0; i < data.GetLength(2); i++)
            {
                for (int j = 0; j < data.GetLength(0); j++)
                {
                    for (int k = 0; k < data.GetLength(1); k++)
                    {
                        arry.Add(new VectorView(j + 1, k + 1, i + 1, data[j, k, i].vx, data[j, k, i].vy, data[j, k, i].vz));
                    }
                }
            }  
            return arry;
        }
    }
}
